Imports System.Windows.Forms

Public Class ConfirmDialog

    Public Sub New(ByVal dialogType As ConfirmDialogType, ByVal message As String)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        InitializeView(dialogType, message)

    End Sub

    Private Sub InitializeView(ByVal confirmDialogType As ConfirmDialogType, ByVal message As String)

        txtMessage.Text = message

        Select Case confirmDialogType
            Case ConfirmDialog.ConfirmDialogType.ConfirmDeletion
                pcbActionImage.Image = New Bitmap(GetType(ConfirmDialog), "DeleteDialog.png")
            Case ConfirmDialog.ConfirmDialogType.ConfirmWarning
                pcbActionImage.Image = New Bitmap(GetType(ConfirmDialog), "WarningDialog.png")
        End Select
        
    End Sub

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Public Enum ConfirmDialogType
        ConfirmDeletion = 0
        ConfirmWarning = 1
    End Enum

End Class
